package com.dianping.cat.consumer.heartbeat.model.entity;

import com.dianping.cat.consumer.heartbeat.model.BaseEntity;
import com.dianping.cat.consumer.heartbeat.model.IVisitor;
import java.util.ArrayList;
import java.util.List;




public class Machine
  extends BaseEntity<Machine>
{
  private String m_ip;
/*  15 */   private List<Period> m_periods = new ArrayList();



  private String m_classpath;



/*  23 */   public Machine(String ip) { this.m_ip = ip; }




/*  28 */   public void accept(IVisitor visitor) { visitor.visitMachine(this); }


  public Machine addPeriod(Period period) {
    this.m_periods.add(period);
/*  33 */     return this;
  }


  public boolean equals(Object obj) {
/*  38 */     if (obj instanceof Machine) {
/*  39 */       Machine _o = (Machine)obj;

/*  41 */       if (!equals(getIp(), _o.getIp())) {
/*  42 */         return false;
      }

/*  45 */       return true;
    }

/*  48 */     return false;
  }

  public Period findPeriod(int minute) {
/*  52 */     for (Period period : this.m_periods) {
/*  53 */       if (period.getMinute() != minute) {
        continue;
      }

/*  57 */       return period;
    }

/*  60 */     return null;
  }


/*  64 */   public String getClasspath() { return this.m_classpath; }



/*  68 */   public String getIp() { return this.m_ip; }



/*  72 */   public List<Period> getPeriods() { return this.m_periods; }





  public void mergeAttributes(Machine other) {
/*  86 */     assertAttributeEquals(other, "machine", "ip", this.m_ip, other.getIp());

/*  88 */     if (other.getClasspath() != null) {
/*  89 */       this.m_classpath = other.getClasspath();
    }
  }

  public Period removePeriod(int minute) {
/*  94 */     int len = this.m_periods.size();

/*  96 */     for (int i = 0; i < len; ) {
/*  97 */       Period period = (Period)this.m_periods.get(i);

/*  99 */       if (period.getMinute() != minute) {
        i++;
        continue;
      }
/* 103 */       return (Period)this.m_periods.remove(i);
    }

/* 106 */     return null;
  }

  public Machine setClasspath(String classpath) {
/* 110 */     this.m_classpath = classpath;
/* 111 */     return this;
  }

  public Machine setIp(String ip) {
/* 115 */     this.m_ip = ip;
/* 116 */     return this;
  }

  public Machine() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/heartbeat/model/entity/Machine.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */